<template>
  <AppLayout
    :pageTitle="'设备监控系统'"
    :leftButtons="leftButtons"
    :rightButtons="rightButtons"
  >
    <!-- 左侧面板 -->
    <div class="left-panel">
      <div class="panel-container">
        <div class="panel-header">
          <div class="header-animation" :style="{ backgroundImage: `url(${shortImageUrl})` }"></div>
          <el-icon><Monitor /></el-icon>
          <span>设备列表</span>
        </div>
        <div class="panel-content">
          <!-- <DeviceList /> -->

        </div>
      </div>
      <div class="panel-container">
        <div class="panel-header">
          <div class="header-animation" :style="{ backgroundImage: `url(${shortImageUrl})` }"></div>
          <el-icon><Warning /></el-icon>
          <span>告警信息</span>
        </div>
        <div class="panel-content">
          <!-- <AlarmList /> -->
        </div>
      </div>
    </div>

    <!-- 中间面板 -->
    <div class="center-panel">
      <div class="panel-container">
        <div class="panel-header">
          <div class="header-animation" :style="{ backgroundImage: `url(${longImageUrl})` }"></div>
          <el-icon><DataLine /></el-icon>
          <span>设备状态</span>
        </div>
        <div class="panel-content">
          <!-- <DeviceStatus /> -->
        </div>
      </div>
    </div>

    <!-- 右侧面板 -->
    <div class="right-panel">
      <div class="panel-container">
        <div class="panel-header">
          <div class="header-animation" :style="{ backgroundImage: `url(${shortImageUrl})` }"></div>
          <el-icon><TrendCharts /></el-icon>
          <span>运行数据</span>
        </div>
        <div class="panel-content">
          <!-- <DeviceData /> -->
        </div>
      </div>
      <div class="panel-container">
        <div class="panel-header">
          <div class="header-animation" :style="{ backgroundImage: `url(${shortImageUrl})` }"></div>
          <el-icon><Setting /></el-icon>
          <span>设备控制</span>
        </div>
        <div class="panel-content">
          <!-- <DeviceControl /> -->
        </div>
      </div>
    </div>
  </AppLayout>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'
import AppLayout from '@/components/Layout/AppLayout.vue'
import {
  Monitor,
  Warning,  
  DataLine,
  TrendCharts,
  Setting
} from '@element-plus/icons-vue'


// 按钮配置
const leftButtons = [
  { label: '农场总览', route: '/home' },
  { label: '设备监控', route: '/devices' },
  { label: '环境监测', route: '/environment' },
  { label: '数据分析', route: '/analysis' }
]

const rightButtons = [
  { label: '系统设置', route: '/settings' },
  { label: '用户管理', route: '/users' },
  { label: '帮助中心', route: '/help' },
  { label: '退出系统', route: '/logout' }
]

// 序列帧动画相关
const shortFrame = ref(0)
const longFrame = ref(0)

const shortImageUrl = computed(() => {
  return `/src/assets/img/short/ok${shortFrame.value.toString().padStart(3, '0')}.png`
})

const longImageUrl = computed(() => {
  return `/src/assets/img/long/ok${longFrame.value.toString().padStart(3, '0')}.png`
})
</script>

<style scoped>
.left-panel, .center-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.left-panel {
  width: 25%;
}

.center-panel {
  width: 50%;
}

.right-panel {
  width: 25%;
}

.panel-container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: linear-gradient(180deg, rgba(18, 161, 127, 0.1) 0%, rgba(18, 161, 127, .45) 100%);
  backdrop-filter: blur(5px);
  box-shadow: 0 0 20px rgba(18, 161, 127, 0.1);
  overflow: hidden;
}

.panel-header {
  font-size: 0.9rem;
  padding: 8px 0 18px 55px;
  color: #33ffd0;
  text-shadow: 0 0 10px rgba(51, 255, 208, 0.3);
  text-align: left;
  position: relative;
  overflow: hidden;
  height: 40px;
  display: flex;
  align-items: center;
  pointer-events: none;
  flex-shrink: 0;
}

.panel-header .el-icon {
  margin-right: 8px;
  font-size: 16px;
  color: #33ffd0;
  text-shadow: 0 0 10px rgba(51, 255, 208, 0.3);
}

.header-animation {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 200%;
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: center;
  opacity: 1;
  z-index: -1;
}

.panel-header span {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.panel-header::after {
  content: '';
  position: absolute;
  right: 0;
  top: 33%;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(51, 255, 208, 0.5),
    rgba(51, 255, 208, 0)
  );
  z-index: 1;
}

.panel-content {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
</style> 